package StudyCode.summary.mycollection;

import java.util.HashMap;
import java.util.Map;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ReversesMap {
	public static <K, V> Map<V, K> reverse(final Map<K, V> map) {
		final Map<V, K> reversed = new HashMap<V, K>(map.size());
		for (final Map.Entry<K, V> e : map.entrySet()) {
			reversed.put(e.getValue(), e.getKey());
		}
		return reversed;
	}
}
